//
//  UpViewController.m
//  UI豆瓣2015到2016跨年作业
//
//  Created by LHY on 15/12/31.
//  Copyright © 2015年 Lanou 32 李昊宇. All rights reserved.
//

#import "UpViewController.h"
#import "TL1View.h"
#import "FourthViewController.h"
#import "ZCViewController.h"

@interface UpViewController ()<UITextFieldDelegate>

@end

@implementation UpViewController

- (void)dealloc
{
    Block_release(_blockZC);
    [super dealloc];
}

- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    
    
    self.view.backgroundColor = [UIColor whiteColor];
  self.navigationItem.title = @"用户登陆";
    self.navigationController.navigationBar.translucent = NO;
    UIBarButtonItem *bar = [[UIBarButtonItem alloc] initWithTitle:@"返回" style:(UIBarButtonItemStylePlain) target:self action:@selector(bar:)];
    self.navigationItem.leftBarButtonItem = bar;
      
    bar.tintColor = [UIColor blackColor];
    
    TL1View *tl = [[TL1View alloc] initWithFrame:CGRectMake(20, 50, 300, 50)];
    tl.Lable.text = @"用户名";
    tl.tf.placeholder = @"请输入用户名";
    [self.view addSubview:tl];
    tl.tf.delegate = self;
    TL1View *tt = [[TL1View alloc] initWithFrame:CGRectMake(20, 120, 300, 50)];
    tt.Lable.text = @"密码";
    tt.tf.placeholder = @"请输入密码";
    [self.view addSubview:tt];
    tt.tf.delegate = self;
    tt.tf.secureTextEntry = YES;
    
    UIButton *button1 = [UIButton buttonWithType:UIButtonTypeCustom];
    button1.frame = CGRectMake(50, 190, 130, 50);
    button1.backgroundColor = [UIColor greenColor];
    [button1 setTitle:@"登陆" forState:UIControlStateNormal];
    button1.layer.cornerRadius = 5;
    [button1 addTarget:self action:@selector(button1:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button1];
    
    UIButton *button2 = [UIButton buttonWithType:UIButtonTypeCustom];
    button2.frame = CGRectMake(200, 190, 130, 50);
    button2.backgroundColor = [UIColor orangeColor];
    button2.layer.cornerRadius = 5;
    button2.layer.borderWidth = 1;
    button2.layer.borderColor = [UIColor lightGrayColor].CGColor;
    [button2 setTitle:@"注册" forState:UIControlStateNormal];
    [button2 addTarget:self action:@selector(button2:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button2];

}

- (void)button1:(UIButton *)button1 {
 
    [self dismissViewControllerAnimated:YES completion:^{
    }];
  
    _blockZC(@"注销");
    


}

- (void)button2:(UIButton *)button2 {
  
    ZCViewController *zc = [[ZCViewController alloc] init];

   
    
    [self.navigationController pushViewController:zc animated:YES];
//    [self.navigationController popToViewController:self.navigationController.viewControllers[1] animated:YES];


}


- (BOOL)textFieldShouldReturn:(UITextField *)textField {
    [textField resignFirstResponder];
    return YES;


}



- (void)bar:(UIBarButtonItem *)bar {

    [self dismissViewControllerAnimated:YES completion:^{
        
    }];


}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
